<template>
  <div class="table-page-search-wrapper">
    <el-row :gutter="20">
      <el-form :model="form" ref="form" :inline="true" label-width="80px">
        <el-col :span="6">
          <el-form-item label="方案名称" prop="moralityPlanName">
            <el-input v-model="form.moralityPlanName" placeholder="请输入方案名称" />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="方案周期" prop="moralityCycleId">
            <el-select clearable v-model="form.moralityCycleId" placeholder="请选择">
              <el-option
                v-for="(item,index) in selectData"
                :key="index"
                :value="item.moralityCycleId"
                :label="item.moralityCycleName"
              />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item>
            <el-tooltip class="item" content="查询" effect="dark" placement="top">
              <el-button type="primary" @click="handleSearch" icon="el-icon-search" />
            </el-tooltip>
            <el-tooltip class="item" content="重置" effect="dark" placement="top">
              <el-button @click="handleReset" icon="el-icon-refresh-right" />
            </el-tooltip>
          </el-form-item>
        </el-col>
      </el-form>
    </el-row>
  </div>
</template>

<script>
import { cycleAll } from '@/api/morality'

export default {
  data() {
    return {
      selectData: [],
      form: {
        moralityPlanName: null,
        moralityCycleId: null,
        pageNo: 1
      }
    }
  },
  mounted() {
    cycleAll().then(res => {
      this.selectData = res.data
    })
  },
  methods: {
    handleSearch() {
      this.$emit('search', this.form)
    },
    handleReset() {
      this.$refs.form.resetFields()
    }
  }
}
</script>

<style scoped>
.el-form-item {
  margin-bottom: 0;
}
</style>
